home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
PowerMacOberon 1.2
/
Dialogs
/
DialogRectangles.Mod
(
.txt
)
< prev
next >
Wrap
Oberon Text
|
1995-06-30
|
3KB
|
92 lines
Syntax10.Scn.Fnt
Syntax10i.Scn.Fnt
StampElems
Alloc
23 Dec 94
Syntax10b.Scn.Fnt
MODULE DialogRectangles;
(** Markus Knasm
ller 29 Aug 94 -
IMPORT DialogFrames, Dialogs, DialogTexts, Display, Display1, GraphicUtils, In, Input, Oberon, Printer, TextFrames, Texts, Viewers;
CONST MM = 1; W* = 30; H* = 20; black = 15;
TYPE
Item* = POINTER TO ItemDesc;
ItemDesc* = RECORD (Dialogs.ObjectDesc)
END;
PROCEDURE (r: Item) Draw* (x, y: INTEGER; f: Display.Frame);
(** displays the object at (x, y) in frame f *)
VAR mode, w, h, bx, by: INTEGER;
BEGIN
r.GetDim (bx, by, w, h); DEC (w); DEC (h);
IF r.selected THEN mode := Display.invert ELSE mode := Display.replace END;
Display1.Line (f, black, x, y, x + w, y, mode); Display1.Line (f, black, x, y, x, y + h, mode);
Display1.Line (f, black, x + w, y, x + w, y + h, mode); Display1.Line (f, black, x, y + h, x + w, y + h, mode);
END Draw;
PROCEDURE (r: Item) Print* (x, y: INTEGER);
(** prints the object at printer coordinates (x, y) *)
VAR w, h, bx, by: INTEGER;
BEGIN
r.GetPDim (bx, by, w, h);
GraphicUtils.PrintBox (x, y, w, h);
END Print;
PROCEDURE (r: Item) Copy* (VAR dup: Dialogs.Object);
(** allocates dup and makes a deep copy of o. Before calling this methode dup should be equal NIL *)
VAR x: Item;
BEGIN
IF dup = NIL THEN NEW (x); dup := x ELSE x := dup(Item) END;
r.Copy^ (dup);
END Copy;
PROCEDURE (r: Item) Track (x, y: INTEGER; keys: SET; f: Display.Frame; p: Dialogs.Panel);
VAR keysum: SET; t: Texts.Text;
BEGIN
IF keys = {MM} THEN
keysum := keys;
REPEAT
Input.Mouse(keys, x, y); keysum := keysum + keys;
Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y)
UNTIL keys = {};
IF keysum = {MM} THEN
IF r.cmd[0] # 0X THEN
DialogTexts.GetParText (r.par, r.panel, t);
r.CallCmd (f, Viewers.This (x, y), t)
END
END
ELSE Oberon.DrawCursor(Oberon.Mouse, Oberon.Arrow, x, y)
END
END Track;
PROCEDURE (r: Item) Handle* (f: Display.Frame; VAR m: Display.FrameMsg);
(** handles messages which were sent to frame f *)
BEGIN
r.Handle^ (f, m);
WITH f: DialogFrames.Frame DO
WITH m: Oberon.InputMsg DO
IF m.id = Oberon.track THEN r.Track (m.X, m.Y, m.keys, f, f.panel) END
ELSE
END
ELSE
END
END Handle;
PROCEDURE Insert*;
(** Insert ([name] [x y w h] | ^ ) inserts a circle - item in the panel containing the caret position *)
VAR x, y, x1, y1, w, h: INTEGER; l: Item; p: Dialogs.Panel; name: ARRAY 64 OF CHAR;
BEGIN
NEW (l);
DialogFrames.GetCaretPosition (p, x, y);
IF (p # NIL) THEN
l.Init; In.Open; In.Name (name);
IF ~In.Done THEN COPY ("", name); In.Open END;
l.SetName (name);
In.Int (x1); In.Int (y1); In.Int (w); In.Int (h);
IF ~In.Done THEN x1 := x; y1 := y; w := W; h := H
ELSE
IF w < 0 THEN w := W END;
IF h < 0 THEN h := H END
END;
l.SetDim (x1, y1, w, h, FALSE); p.Insert (l, TRUE)
ELSE
Dialogs.res := Dialogs.noPanelSelected
END;
IF Dialogs.res # 0 THEN Dialogs.Error ("DialogRectangles") END;
END Insert;
END DialogRectangles.